//
// Created by 86183 on 2022/12/6.
//

#ifndef TEST_01_C_STU_H
#define TEST_01_C_STU_H

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>

#define MAX_ID_LEN 20
#define MAX_NAME_LEN 15
#define MAX_PASSWORD_LEN 30
#define MAX_GENDER_LEN 10
#define MAX_PHONENUMBER_LEN 20
#define VERIFICATION_LEN 5

typedef struct StudentInfo
{
    char id[MAX_ID_LEN];
    char name[MAX_NAME_LEN];
    int age;
    char gender[MAX_GENDER_LEN];
    int grade;
}StudentInfo;

typedef struct NodeStudent
{
    StudentInfo data;
    struct NodeStudent* next;
}NodeS;

typedef struct AdminInfo
{
    char username[MAX_NAME_LEN];
    char password[MAX_PASSWORD_LEN];
    char id[MAX_ID_LEN];
    char phoneNumber[MAX_PHONENUMBER_LEN];
}AdminInfo;

typedef struct NodeAdmin
{
    AdminInfo data;
    struct NodeAdmin* next;
}NodeA;

void WelcomeS();
void WelcomeA();
void init_listS(NodeS** pS);
void init_listA(NodeA** pA);
void output_one_student(NodeS* S);
void output_all_students(NodeS* S);
void Register(NodeA* A);
bool sign_in(NodeA* A);
void forget_password(NodeA* A);
bool insert_student(NodeS* S, StudentInfo stu, int choice);
StudentInfo* create_student();
int save_to_file(NodeS* S);
void destroy_list(NodeS** pS);
NodeS* search_student(NodeS *S, char* student_id);
bool delete_student(NodeS* S, char* student_id);
bool change_student(NodeS *S, char* student_id, StudentInfo new_info);
void bubble_sort(NodeS *S);
void destroy_list_and_file(NodeS** pS);

#endif //TEST_01_C_STU_H
